package com.zzyl.mapper;

import com.github.pagehelper.Page;
import com.zzyl.dto.NursingPlanDto;
import com.zzyl.entity.NursingPlan;
import com.zzyl.vo.NursingPlanVo;
import org.apache.ibatis.annotations.Delete;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Select;
import org.apache.ibatis.annotations.Update;

import java.util.List;

@Mapper
public interface NursingPlanMapper {
    /**
     * 分页查询护理计划
     * @param name
     * @param status
     * @return
     */
    Page<NursingPlanVo> queryAll(String name, Integer status);

    /**
     * 添加护理计划
     * @param nursingPlan
     */
    void add(NursingPlan nursingPlan);

    /**
     * 根据id查询护理计划
     * @param id
     * @return
     */
    @Select("select * from nursing_plan where id=#{id}")
    NursingPlan getById(Long id);

    /**
     * 修改护理计划
     * @param nursingPlanDto
     */
    void updateById(NursingPlanDto nursingPlanDto);

    /**
     * 根据id删除护理计划
     * @param id
     */
    @Delete("delete from nursing_plan where id=#{id}")
    void deleteById(Long id);

    /**
     * 修改状态
     * @param id
     * @param status
     */
    @Update("update nursing_plan set status = #{status} where id = #{id}")
    void updateStatus(Long id, Integer status);

    /**
     * 查询所有护理计划
     * @param nursingPlan
     * @return
     */
    @Select("select * from nursing_plan")
    List<NursingPlan> list(NursingPlan nursingPlan);
}
